<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>车辆投票系统</title>
    <link rel="stylesheet" href="bootstrap-4.4.1-dist/bootstrap-4.4.1-dist/css/bootstrap.css">
    <script src="bootstrap-4.4.1-dist/bootstrap-4.4.1-dist/js/bootstrap.js"></script>

    <style>
        .login {
            text-align: right;
            margin-bottom: 20px;
        }
        .img {
            position: relative;
        }
        .row img {
            width: 100%;
        }
        .img .row {
            position: absolute;
            bottom: 0;
            left: 15px;
            background: rgba(0,0,0,0.5);
            width: 100%;
            color: white;
            font-size: 8px;
        }
        p {
            margin: 10px 0 !important;
        }
    </style>
</head>
<body>
<div class="container">
    <h1 class="text-center">
        我最爱车辆投票
    </h1>
    <p class="login">
        登录  注册
    </p>
    <div class="row">
        <?php
            include_once 'conn.php';
            $sql = 'select * from carinfo order by id desc';
            $result = mysqli_query($conn,$sql);
            while($info = mysqli_fetch_array($result)){
        ?>
        <div class="clo-xs-12 col-sm-6 col-md-4 col-lg-3">
            <div class="img">
                <a href="vote.php?id=<?php echo $info['id'] ?>">
                     <img src="img/<?php echo $info['carPic']; ?>">
                </a>
                <div class="row">
                    <div class="col-xs-12 col-sm-8 col-md-6">
                        <p class="text-center"><?php echo $info['carName']; ?></p>
                    </div>
                    <div class="col-xs-12 col-sm-4 col-md-6">
                        <p class="text-center">当前投票数：<?php echo $info['carNum']; ?></p>
                    </div>
                </div>
            </div>
            <p><?php echo $info['carDesc']; ?></p>
        </div>
        <?php
            }
        ?>
    </div>
</div>

</body>
</html>